package com.nbsaas.boot.nbtask.controller;

import com.nbsaas.boot.nbtask.task.QueueMonitorService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/monitor")
public class QueueMonitorController {

    private final QueueMonitorService queueMonitorService;

    public QueueMonitorController(QueueMonitorService queueMonitorService) {
        this.queueMonitorService = queueMonitorService;
    }

    @GetMapping("/queue/{name}")
    public String getQueueSize(@PathVariable String name) {
        return "Queue size: " + queueMonitorService.getQueueSize(name);
    }

}
